package com.yanqu.road.entity.activity.recallplayer.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_u_recalled_bind_data")
public class UserRecallBeBindData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "邀请本玩家的邀请码")
    private String recallCode = "";
    @FieldTypeAnnotation(desc = "邀请本玩家的预邀请码")
    private String preBindRecallCode = "";
    @FieldTypeAnnotation(desc = "玩家掌柜分级 0未分级 1 2 3 优秀卓越传奇")
    private int userType;
    @FieldTypeAnnotation(desc = "绑定任务信息")
    private List<RecallPlayerBeBindTaskValue> taskInfos;


    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public String getRecallCode() {
        return recallCode;
    }

    public void setRecallCode(String recallCode) {
        if (recallCode == null) {
            return;
        }
        if (this.recallCode == null || !this.recallCode.equals(recallCode)) {
            this.recallCode = recallCode;
            setOp(DataStatus.Update);
        }
    }

    public String getPreBindRecallCode() {
        return preBindRecallCode;
    }

    public void setPreBindRecallCode(String preBindRecallCode) {
        this.preBindRecallCode = preBindRecallCode;
    }

    public int getUserType() {
        return userType;
    }

    public void setUserType(int userType) {
        if (this.userType != userType) {
            this.userType = userType;
            setOp(DataStatus.Update);
        }
    }

    public java.util.List<com.yanqu.road.entity.activity.recallplayer.data.RecallPlayerBeBindTaskValue> getTaskInfos() {
        return taskInfos;
    }

    public void setTaskInfos(java.util.List<com.yanqu.road.entity.activity.recallplayer.data.RecallPlayerBeBindTaskValue> taskInfos) {
        if (null == taskInfos) {
            return;
        }
        if (this.taskInfos == null || !this.taskInfos.equals(taskInfos)) {
            this.taskInfos = taskInfos;
            setOp(DataStatus.Update);
        }
    }


    public void resetPreBind() {
        setPreBindRecallCode("");
        setTaskInfos(new ArrayList<>());
    }

    public void recallBindSuccess(String recallCode) {
        setRecallCode(recallCode);
    }

    public void resetBind() {
        setRecallCode("");
        resetPreBind();
    }

    public boolean isBind() {
        return (!preBindRecallCode.isEmpty() || !recallCode.isEmpty());
    }
}
